<template>
  <div class="title-wrapper">
    <div class="title">{{titleName}}</div>
    <div class="right">
      <span class="home" title="主页" @click="$emit('gotoHomePage')"><svg t="1658890003781" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="37052" 
        width="18" height="18"><path d="M946.5 505L534.6 93.4c-12.5-12.5-32.7-12.5-45.2 0L77.5 505c-12 12-18.8 28.3-18.8 45.3 0 35.3 28.7 64 64 64h43.4V908c0 17.7 14.3 32 32 32H448V716h112v224h265.9c17.7 0 32-14.3 32-32V614.3h43.4c17 0 33.3-6.7 45.3-18.8 24.9-25 24.9-65.5-0.1-90.5z" p-id="37053" 
        fill="#707070"></path></svg></span>
    <span class="back" @click="$emit('returnToPreviousPage')">
      <svg-icon icon-class="goback"></svg-icon>
      <span>返回上一页</span>
    </span>
    </div>
  </div>
</template>

<script>
import { defineComponent } from "vue";

export default defineComponent({
  name: "SubTitle",
  props: ['titleName'],
  emits: ['gotoHomePage', 'returnToPreviousPage'],
})
</script>

<style scoped lang="scss">
  .title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f2f4f9;
    padding-left: 41px;
    height: var(--title-wrapper-height);
    line-height: var(--title-wrapper-height);
    margin-bottom: var(--title-wrapper-margin-bottom);

  .title {
    font-weight: 700;
    font-size: var(--title-font-size);
  }

  .right {
    display: flex;
    align-items: center;

    .home {
      display: flex;
      align-items: center;
      cursor: pointer;
      margin-right: 8px;
    }
    
  .back {
    cursor: pointer;
    color: var(--title-font-color);
    font-size: var(--title-font-size);

    svg {
      font-size: 18px;
      vertical-align: middle;
    }

    span {
      margin: 0 5px;
      font-size: var(--content-font-size);
    }
  }
  }
}
</style>